<?php
ob_start();
require_once substr(dirname(__FILE__),0,-1).'sub/init.php';
if(!is_mobile())header("Location: ".Href('my'));
$currfields = 'id,pwd,flag,sign_time,dataflag,sex,photo_s,photo_f,photo_ifshow,flag,loveb,money,RZ,if2,sjtime,sjtime2,sign_time,grade,subscribe,myinfobfb,openid,ifWeixinPushInfo,nickname,ifadm,click,areatitle,longitude,latitude';
require_once ZEAI.'m/my_chk_u.php';
if($submitok=='ajax_tipnum_tb'){
	//$tipnum1 = $db->COUNT(__TBL_MSG__,"new=1 AND ifdel=0 AND uid=".$cook_uid);
	//$tipnum2 = $db->COUNT(__TBL_TIP__,"new=1 AND uid=".$cook_uid);
	//$tipnum = $tipnum1+$tipnum2;
	$db->query("UPDATE ".__TBL_USER__." SET endtime=".ADDTIME.",chatHiContact_iftips=1 WHERE id=".$cook_uid);
	exit;
}elseif($submitok=='ajax_iMarquee'){
	$rt=$db->query("SELECT id,title FROM ".__TBL_NEWS__." WHERE kind=1 AND id>2 AND flag=1 ORDER BY px DESC LIMIT 5");
	$total = $db->num_rows($rt);
	$c = '';
	if ($total>0){
		for($i=1;$i<=$total;$i++) {
			$rows = $db->fetch_array($rt,'name');
			if(!$rows) break;
			$title = trimhtml(dataIO($rows['title'],'out'));
			$id     = $rows['id'];
			$c.= '<li><a href="'.HOST.'/m/about.php?fid='.$id.'">'.$title.'</a></li>';
		}
	}
	exit($c);
}
$if_other_login_subscribe = openid_chk();
require_once ZEAI.'cache/config_vip.php';
require_once ZEAI.'cache/config_wxgzh.php';
require_once ZEAI.'cache/config_reg.php';
require_once ZEAI.'cache/config_shop.php';
$TG_set = json_decode(stripslashes($_REG['TG_set']),true);
setUcookie($row);
$cook_grade    = intval($row['grade']);if($cook_grade>1)zeai_chk_ugrade(intval($cook_uid));
$cook_openid   = $row['openid'];
$cook_ifadm    = $row['ifadm'];
$cook_subscribe= $row['subscribe'];
$cook_myinfobfb= $row['myinfobfb'];
$cook_click    = $row['click'];
$cook_RZ       = $row['RZ'];$RZarr=explode(',',$cook_RZ);
$cook_photo_f  = $row['photo_f'];
$cook_loveb    = $row['loveb'];
$cook_money    = $row['money'];
$cook_sign_time= $row['sign_time'];
$cook_dataflag = $row['dataflag'];
$cook_photo_ifshow  = $row['photo_ifshow'];
$cook_flag  = $row['flag'];
$ifWeixinPushInfo = $row['ifWeixinPushInfo'];
$cook_sjtime = $row['sjtime'];
$cook_sjtime2= $row['sjtime2'];
setcookie("cook_areatitle",$row['areatitle'],time()+31536000,"/",$_ZEAI['CookDomain']);
setcookie("cook_longitude",$row['longitude'],time()+31536000,"/",$_ZEAI['CookDomain']);
setcookie("cook_latitude",$row['latitude'],time()+31536000,"/",$_ZEAI['CookDomain']);
$SHALOU_ROW=shalou_data($cook_uid,'all');
$SHALOU_ARR=json_decode($SHALOU_ROW['jsonstr'],true);
if (!empty($SHALOU_ARR)){
	$cook_sex     = $SHALOU_ARR['sex'];
	$cook_photo_s = $SHALOU_ARR['photo_s'];	
	$cook_nickname= trimhtml(dataIO($SHALOU_ARR['nickname'],'out'));
	$cook_myinfobfb= get_shalou_ed_bfb($SHALOU_ARR);
}else{
	$cook_nickname = trimhtml(dataIO($row['nickname'],'out'));
	$cook_sex      = $row['sex'];
	$cook_photo_s  = $row['photo_s'];
}
//跳转
$switch = json_decode($_ZEAI['switch'],true);
$force_data_bfb=intval($switch['force']['data_bfb']);
$force_data_bfb=(empty($force_data_bfb))?60:$force_data_bfb;
if ($switch['force']['data'] == 1 && $cook_myinfobfb < $force_data_bfb)zeaialert('{"title":"亲，您的【个人资料完善度不足'.$force_data_bfb.'％】，请完善","btnt":"立即完善","url":"'.mHref('my_info').'"}');
if ($switch['force']['photom'] == 1 && empty($cook_photo_s))zeaialert('{"title":"亲，请您先【上传头像】","btnt":"立即上传","url":"'.mHref('my_info').'"}');
if ($switch['force']['mob'] == 1 && !in_array('mob',$RZarr))zeaialert('{"title":"亲，请您先认证【手机认证】","btnt":"立即认证","url":"'.HOST.'/m/my_cert.php?t=mob"}');
if ($switch['force']['cert'] == 1 && !in_array('identity',$RZarr)  && !$ifforce )zeaialert('{"title":"亲，请您先认证【实名认证】","btnt":"立即认证","url":"'.HOST.'/m/my_cert.php?t=identity"}');
/*跳转结束*/

$photo_s_url = (!empty($cook_photo_s))?UP.smb($cook_photo_s,'m'):RES.'my_m'.$cook_sex.'.png';
if($cook_photo_ifshow==0 || $cook_flag==-2){
	$photo_s_hide_cls=RES.' class="photo_s_hide"';
	$photo_s_hide_t='<span>已隐藏</span>';
}
$viewlist = json_decode($_VIP['viewlist'],true);
$gznum = $db->COUNT(__TBL_GZ__,"flag=1 AND senduid=".$cook_uid);
$fsnum = $db->COUNT(__TBL_GZ__,"flag=1 AND uid=".$cook_uid);
/**/
$signflag = 1;
if($cook_sign_time>0){
	$old_time = YmdHis($cook_sign_time,"Ymd");
	$now_time = YmdHis(ADDTIME,"Ymd");
	if($now_time==$old_time)$signflag = 0;
}
if($_VIP['sign_numlist']=='0')$signflag = 0;
$nav='my';
if($_ZEAI['m_mb']==2){require_once ZEAI.'m/my2.php';exit;}
?>
<!doctype html><html><head><meta charset="utf-8">
<title>我的-<?php echo $_ZEAI['siteName'];?></title>
<?php echo HEADMETA; ?>
<meta name="generator" content="Zeai.cn V9" />
<link href="<?php echo RES;?>m/css/m.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo HOST;?>/cache/zeaicolor.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<link href="<?php echo RES;?>m/css/my_index.css?<?php echo $_ZEAI['cache_str'];?>" rel="stylesheet" type="text/css" />
<script src="<?php echo RES;?>www_zeai_cn.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<script src="<?php echo RES;?>m/js/m.js?<?php echo $_ZEAI['cache_str'];?>"></script>
<?php
if (is_weixin()){
	require_once ZEAI."api/weixin/jssdk.php";?>
	<script src="<?php echo RES;?>jweixin-1.2.0.js"></script>
	<script>
	wx.config({debug: false,
		appId:'<?php echo $signPackage["appId"];?>',
		timestamp:<?php echo $signPackage["timestamp"];?>,
		nonceStr:'<?php echo $signPackage["nonceStr"];?>',
		signature:'<?php echo $signPackage["signature"];?>',
		jsApiList:['onMenuShareTimeline','onMenuShareAppMessage','onMenuShareQQ','onMenuShareWeibo']
	});
	</script>
<?php }?>
</head>
<body>
<style>
header:after{background-color:<?php echo $_ZEAI['mob_mbcolor'];?>}
#my_loveb i{font-size:2.1rem}
#my_loveb em.qdbox{display:none}
#my_loveb em.adbox{display:block}
#my_loveb.ed em.qdbox{display:block}
#my_loveb.ed em.adbox{display:none}
.iMarqueeBox h5{background-color:rgba(<?php echo c16_rgb($_ZEAI['mob_mbcolor']);?>,.7)}
</style>
<header>
	<div class="set">
        <a href="<?php echo HOST;?>/m/my_set.php" class="ico">&#xe6e8;</a>
        <a href="<?php echo HOST;?>/m/about.php?t=contact" class="ico">&#xe784;</a>
    </div>
	<p>
    <a href="<?php echo a('{"kind":"u","uid":'.$cook_uid.'}');?>"<?php echo $photo_s_hide_cls;?>><?php echo $photo_s_hide_t;?><img src="<?php echo $photo_s_url;?>"></a>
    <a href="my_vip_my.php" class="<?php echo ($cook_grade>1)?'vip':'hui';?>"><?php echo utitle($cook_grade);?></a>
    </p>
	<div class="nickname"><h3><?php echo uicon($cook_sex.$cook_grade);?><b><?php echo $cook_nickname; ?></b><font class="S14">(ID:<?php echo $cook_uid; ?>)</font></h3></div>
	<div class="databox" onClick="zeai.openurl('<?php echo HOST;?>/m/my_info.php')">
    	资料完善度<?php echo $cook_myinfobfb;?>%<?php if($cook_dataflag==0){echo '<font class="dflag0">审核中</font>';}elseif($cook_dataflag==2){echo '<font class="dflag2">已驳回</font>';}?>
    	<div class="bfbbox">
        	<div class="bfb" style="width:<?php echo $cook_myinfobfb;?>%"></div>
        </div>
    </div>
	<a href="<?php echo HOST;?>/m/my_info.php" class="jt ico">修改资料&#xe601;</a>
    <div class="myb">
        <a href="<?php echo HOST;?>/m/my_follow.php"><b><?php echo $gznum;?></b><span>我喜欢</span></a>
        <a href="<?php echo HOST;?>/m/my_follow.php?t=2"><b><?php echo $fsnum;?></b><span>喜欢我</span></a>
        <a href="<?php echo HOST;?>/m/my_loveb.php" id="my_loveb">
        	<em class="adbox"><b><?php echo $cook_loveb;?></b><span><?php echo $_ZEAI['loveB'];?></span></em>
        	<em class="qdbox"><i class="ico qiandao">&#xe64b;</i><br>签到</em>
        </a>
        <?php if ($_VIP['ifmoney'] == 1){?>
        <a href="<?php echo HOST;?>/m/my_money.php"><b><?php echo str_replace(".00","",number_format($cook_money,2));?></b><span>余额</span></a>
        <?php }else{ ?>
        <a href="<?php echo HOST;?>/m/my_browse.php?t=1"><b><?php echo $cook_click;?></b><span>浏览量</span></a>
        <?php }?>
    </div>
</header>
<div class="box enter4">
    <a href="<?php echo HOST;?>/m/my_vip.php"><i class="ico vip">&#xe611;</i><span>开通VIP</span></a>
    <a href="<?php echo HOST;?>/m/my_cert.php"><i class="ico cert">&#xe66b;</i><span>诚信认证</span></a>
    <?php if(@in_array('hn',$navarr)){?><a href="<?php echo HOST;?>/m/my_hongniang.php"><i class="ico hongniang">&#xe613;</i><span>红娘牵线</span></a><?php }?>
    <a href="<?php echo HOST;?>/m/my_mateshow.php"><i class="ico match">&#xe8ab;</i><span>智能配对</span></a>
</div>
<div class="clear"></div>
<div class="box">
	<h1>谁看过我<a href="<?php echo HOST;?>/m/my_browse.php?t=2">我看过谁<i class="ico">&#xe601;</i></a></h1>
    <div class="my_Iviewuser" onclick="<?php if ($viewlist[$cook_grade]!=1){?>zeai.openurl('<?php echo HOST;?>/m/my_vip.php');<?php }else{ ?>zeai.openurl('<?php echo HOST;?>/m/my_browse.php');<?php }?>">
    	<div class="ivubox">
		<?php 
		$vwnum = $db->COUNT(__TBL_CLICKHISTORY__,"uid=".$cook_uid);
		$rt=$db->query("SELECT a.senduid,a.new,a.addtime,b.sex,b.photo_s,b.photo_f,b.flag,b.photo_ifshow FROM ".__TBL_CLICKHISTORY__." a,".__TBL_USER__." b WHERE a.senduid=b.id AND a.uid=".$cook_uid." ORDER BY a.addtime DESC LIMIT 8");
		$total = $db->num_rows($rt);
		if ($total == 0) {
			echo '<i class="ico">&#xe659;</i>';
		} else {
			$viewblurClass = ($viewlist[$cook_grade]!=1)?' class="blur"':'';
			for($ii=1;$ii<=$total;$ii++) {
				$rows = $db->fetch_array($rt,'name');
				if(!$rows) break;
				$senduid = $rows['senduid'];
				$sex     = $rows['sex'];
				$new     = $rows['new'];
				$new_str = ($new == 1)?'<b></b>':'';
				$photo_s  = $rows['photo_s'];
				$photo_f  = $rows['photo_f'];
				$uflag     = $rows['flag'];
                $photo_ifshow = $rows['photo_ifshow'];
				$photo_s_url=photo_s_out('{"sex":"'.$sex.'","photo_s":"'.$photo_s.'","photo_f":"'.$photo_f.'","photo_ifshow":"'.$photo_ifshow.'","uflag":"'.$uflag.'","outkind":"url"}');			
				echo '<span><img src="'.$photo_s_url.'"'.$viewblurClass.'></span>';
			}
		}
		if ($viewlist[$cook_grade]!=1){
			$urole = json_decode($_ZEAI['urole']);
			if (count($urole) >= 1 && is_array($urole)){
				foreach ($urole as $uc) {
					$cgrade = $uc->g;
					if($viewlist[$cgrade] == 1){
						$maxgradeT=utitle($cgrade);
						break;
					}
				}
			}
			$maxgradeT = ($cook_grade==1)?'点击开通VIP查看':'点击升级'.$maxgradeT.'查看';
		}
        ?>
        </div>
    	<h5>最近有<b><?php echo $vwnum;?></b>人看过你<?php if ($viewlist[$cook_grade]!=1){?>，<font class="zeaicolor"><?php echo $maxgradeT;?></font><?php }?></h5>
    </div>
</div>
<?php 
$rtt2=$db->query("SELECT COUNT(*) FROM ".__TBL_HH__." a,".__TBL_USER__." b WHERE a.uid=".$cook_uid." AND a.senduid=b.id AND a.ifagree=0");
$roww2 = $db->fetch_array($rtt2,'num');
$b_hh=$roww2[0];
$b_hh = ($b_hh>0)?'<b>'.$b_hh.'</b>':'';
?>
<div class="box ">
	<h1>我的相亲</h1>
    <div class="appul">
        <?php if(@in_array('sign',$navarr)){?><a href="<?php echo HOST;?>/m/my_sign.php"><i class="ico sign">&#xe699;</i><span>承诺书</span><b>签字</b></a><?php }?>
		<?php if(@in_array('tg',$navarr)){?><a href="<?php echo HOST;?>/m/tg_my.php"><i class="ico tg">&#xe612;</i><span><?php echo $TG_set['navtitle'];?></span></a><?php }?>
		<?php if(@in_array('shop',$navarr)){?><a href="<?php echo HOST;?>/m/shop_my.php"><i class="ico shop">&#xe71a;</i><span><?php echo $_SHOP['title'];?></span></a><?php }?>
        <?php if(@in_array('contact_hh',$navarr)){?><a href="<?php echo HOST;?>/m/my_huhuan.php"><i class="ico ask">&#xe691;</i><span>互换</span><?php echo $b_hh;?></a><?php }?>
    	<a href="<?php echo HOST;?>/m/my_mateshow.php"><i class="ico match">&#xe8ab;</i><span>我的配对</span></a>
    	<?php if(@in_array('xqcard',$navarr)){?><a href="<?php echo a('{"kind":"card"}');?>"><i class="ico xqk">&#xe6b6;</i><span>相亲卡</span></a><?php }?>
    	<?php if(@in_array('video',$navarr)){?><a href="<?php echo HOST;?>/m/my_video.php"><i class="ico video">&#xe68a;</i><span>我的视频</span></a><?php }?>
    	<a href="<?php echo HOST;?>/m/my_photo.php"><i class="ico photo">&#xe648;</i><span>我的相册</span></a>
    	<?php if(@in_array('trend',$navarr)){?><a href="<?php echo HOST;?>/m/trend.php?submitok=my"><i class="ico trend">&#xe63b;</i><span>我的动态</span></a><?php }?>
    	<?php if(@in_array('dating',$navarr)){?><a href="<?php echo HOST;?>/m/dating.php?submitok=my"><i class="ico dating">&#xe6a9;</i><span>我的约会</span></a><?php }?>
    	<?php if(@in_array('gift',$navarr)){?><a href="<?php echo HOST;?>/m/my_gift.php"><i class="ico gift">&#xe600;</i><span>我的礼物</span></a><?php }?>
    	<?php if(@in_array('qun',$navarr)){?><a href="qun.php?t=2"><i class="ico qun">&#xe647;</i><span>我的群</span></a><?php }?>
    </div>
    <div class="clear"></div>
</div>
<?php
$rz_dataARR = explode(',',$_ZEAI['rz_data']);
if (count($rz_dataARR)>0 && is_array($rz_dataARR)){
    function RZchkFlag($objstr,$RZarr) {
        global $cook_uid,$db;
        if (!in_array($objstr,$RZarr)){
            $doing = $db->COUNT(__TBL_RZ__,"uid=".$cook_uid." AND rzid='$objstr' AND flag=0");
            if ($doing>0)return '<h5>审核中</h5>';
        }else{
            return '';
        }
    }?>
<style>
.cert .RZBOX{margin-top:1rem}
.my_cert{padding:2rem 0 0 0;clear:both;overflow:auto}
.my_cert li{width:25%;text-align:center;float:left;height:8.5rem;position:relative}
.my_cert li i{width:5rem;height:5rem;line-height:5rem;font-size:2.8rem;color:#fff;display:inline-block;background-color:#ddd;border-radius:2.8rem 2.8rem 0 2.8rem;position:relative;
color:#fff;width:4rem;height:4rem;line-height:4rem;box-sizing:border-box;-webkit-box-sizing:border-box;-moz-box-sizing:border-box
}
.my_cert li.ed i{color:#fff;border:0}
.my_cert li i:after{content:'\e62c';position:absolute;bottom:-.5rem;right:-.5rem;font-size:1.6rem;width:1.6rem;height:1.6rem;line-height:1.6rem;border-radius:1.6rem;color:#ddd;background-color:#fff;border:#fff .2rem solid}
.my_cert li.ed h5{color:#090}
.my_cert li.ed i:after{content:'\e60f';background-color:#fff;color:#1ED76D}
.my_cert li h3{font-size:1.4rem;margin:.8rem auto .5rem auto;color:#888}
.my_cert li h5{position:absolute;top:-1rem;right:.5rem;right:-webkit-calc(50% - 2.2rem);width:4.4rem;margin:.5rem auto 3rem auto;font-size:1.2rem;height:1.6rem;line-height:1.6rem;display:block;border-radius:1rem;background-color:#f00;color:#fff}
</style>
    <div class="box cert" style="display:none">
        <h1>诚信认证</h1>
        <ul class="my_cert " id="my_certbox">
            <?php
                foreach ($rz_dataARR as $k=>$V){?>
                <li id="<?php echo $V;?>" class="rz<?php echo (in_array($V,$RZarr))?' ed':'';?>"><i class="ico <?php echo $V;?>"<?php echo (in_array($V,$RZarr))?' style="background-color:'.rz_data_info($V,'color').'"':'';?>><?php echo rz_data_info($V,'ico');?></i><h3><?php echo rz_data_info($V,'title');?></h3><?php echo RZchkFlag($V,$RZarr);?></li>
            <?php }?>
            <div class="clear"></div>
        </ul>
    </div>
    <?php
}
if ($signflag == 1){?>
<script>
(function qiandaoFn() {
	if(my_loveb.hasClass('ed')){my_loveb.removeClass('ed')}else{my_loveb.class('ed loop_s_b_s')}
	setTimeout(function(){qiandaoFn()},1000);
})()
</script>
<?php }
if($cook_ifadm==1)echo '<a href="'.$_ZEAI['adm2'].'/m_login.php" class="ifadm">后台<br>管理</a>';
require_once ZEAI.'m/footer.php';
require_once ZEAI.'m/bottom.php';
if (is_weixin() && !empty($_GZH['wx_gzh_ewm']) && $cook_subscribe!=1){
	@wx_endurl('您刚刚浏览的页面【我的】',a('{"kind":"my","mp":"mob"}'));
	if (ifint($if_other_login_subscribe)){?>
		<script>zeai.msg('当前微信号已被其它帐号（用户ID：<?php echo $if_other_login_subscribe;?>）绑定，请退出使用微信登录',{time:5});/*setScrollTop(0);*/o('main').scrollTop=1000;</script><?php
	}else{?>
		<div id="subscribe_box" class="my-subscribe_box"><img src="<?php echo UP.$_GZH['wx_gzh_ewm']; ?>?<?php echo $_ZEAI['cache_str'];?>"><h3>长按二维码关注公众号<br>获取帐号消息通知等全功能体验<br>关注成功之后将不再弹出</h3></div>
		<script>setTimeout(function(){ZeaiM.div({obj:subscribe_box,w:26,h:30});},500);</script><?php
	}?>
<?php }else{
	//蹦
	$bounce=json_decode($_ZEAI['bounce'],true);
	if($bounce['flag']['vipdatarz'] == 1 && (!empty($cook_openid) || ifint($cook_uid))){
		$bouncev = '';
		$bounceTip = 'cook_my_bounce'.YmdHis(ADDTIME,'d');
		if(empty($bouncev) && ($cook_myinfobfb<$force_data_bfb || empty($cook_photo_s)  ) && $_COOKIE[$bounceTip.'my_info'] != 'my_info' && !empty($bounce['my_info_picurl']) ){
			$bouncev='my_info';$url=mHref('my_info');$picurl=UP.$bounce['my_info_picurl'];
		}
		if(empty($bouncev) && !in_array('identity',$RZarr) && $_COOKIE[$bounceTip.'my_rz'] != 'my_rz'  && !empty($bounce['rz_picurl']) ){
			$bouncev='my_rz';$url=mHref('cert');$picurl=UP.$bounce['rz_picurl'];
		}
		if(!empty($bouncev)){
			$bounceTip = $bounceTip.$bouncev;
			if($_COOKIE[$bounceTip] != $bouncev){
				setcookie($bounceTip,$bouncev,null,"/",$_ZEAI['CookDomain']);
				?>
				<script>var my_divclose;setTimeout(function(){my_divclose=ZeaiM.div_pic({obj:my_bounce_box,w:32,h:36});},1500);</script>
				<div id="my_bounce_box" class="bounce_box bounce"><img style="width:100%;display:block" src="<?php echo $picurl;?>" onClick="my_divclose.click();if(zeai.empty(o('my_info')) && zeai.empty(o('my_rz'))  )zeai.openurl('<?php echo $url;?>');"></div>
				<?php
			}
		}
	}
}
$db->query("UPDATE ".__TBL_USER__." SET endtime=".ADDTIME." WHERE id=".$cook_uid);
if ($ifWeixinPushInfo == 1)wx_sent_kf_PushInfo($cook_openid);
ob_end_flush();?>